Ext.namespace("Message");

Message.Msg = function(fn,title,checkOne) {
	this.fn=fn;
	this.title=title;
	this.txtRemind=null;
	this.checkOne=checkOne;
	this.chkRemind = new Ext.form.CheckboxGroup({
		width:120,
		name:'remind',
		fieldLabel: '提醒设置',
		items: [
		      {boxLabel: '短信', name: 'smsRemind',inputValue: '1'},
		      {boxLabel: '邮件', name: 'emailRemind',inputValue: '2'}
		]
	});
	this.msg=new Ext.form.Label({
			html:'<font color="red" size="2">'+this.title+'</font>'
		});
	this.form = new Ext.form.FormPanel({
        bodyStyle: 'padding: 5px 5px 0',
        labelWidth: 55,
        frame:true,
        labelAlign: 'right',
        items: [this.msg,this.chkRemind]
    });
	
	Message.Msg.superclass.constructor.call(this, {
		title: '提醒方式',
		autoHeight: true,
        width: 300,
        resizable: false,
        plain: true,
        modal: true,
        autoScroll: false,
        closeAction: 'hide',
        items: [this.form],
		buttons:[{
			text: '确定',
			cls: 'x-btn-text-icon btn-save',
			handler: this.onSend,
			scope: this
        }, {
            text: '取消',
            cls: 'x-btn-text-icon btn-cancel',
            handler: this.hide.createDelegate(this, [])
        }]
    });
};
Ext.extend(Message.Msg, Ext.Window,{	
	onSend: function(btn, event) {
		var iptvalue =0;
		if(this.chkRemind.items.items[0].checked){
			iptvalue+=1;
		}
		if(this.chkRemind.items.items[1].checked){
			iptvalue+=2;
		}
		
		//alert(this.txtRemind);
		if(this.checkOne&&iptvalue==0){
			Utils.warn2("请选择提醒方式！",180);
		}else{
			this.txtRemind=iptvalue;
			this.hide();
			this.fn();
		}
	}
});
